﻿using Shop.RemoteModel.ActivityDiscount.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Api
{
    [ApiRouteName("/shop/activity/discount/{name}")]
    internal class ActivityDiscountApi : ApiController
    {
        private readonly IActivityDiscountService _Service;

        public ActivityDiscountApi (IActivityDiscountService service)
        {
            this._Service = service;
        }

        public DiscountSet Get ([NumValidate("shop.activity.id.error", 1)] long activityId)
        {
            return this._Service.Get(activityId);
        }

        public void Set (LongParam<DiscountSet> set)
        {
            this._Service.Set(set.Id, set.Value);
        }
    }
}
